package com.liandu.common;


import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * @author yeym
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class JResponse implements Serializable {
    private static final long serialVersionUID = 4826409915402924505L;
    private Integer code;
    private String msg;
    private Object data;

    public static  JResponse successful(Object data){
        return new JResponse(200,"success",data);
    }

    public static  JResponse successful(String msg,Integer code){
        return new JResponse(code,msg,null);
    }

    public static  JResponse successful(){
        return new JResponse(200,"success",null);
    }

    public static  JResponse loginLoss(){return new JResponse(4000,Common.LOGIN_LOSS,null);}

    public static JResponse fail(String msg,Object data){
        return new JResponse(4001,msg,data);
    }

    public static  JResponse fail(String msg){
        return new JResponse(4001,msg,null);
    }

 }
